//
//  DKLoginViewController.m
//  BS1
//
//  Created by 丁侃 on 16/4/25.
//  Copyright © 2016年 丁侃. All rights reserved.
//

#import "DKLoginViewController.h"

@interface DKLoginViewController ()
@property (weak, nonatomic) IBOutlet UIButton *account;

@property (weak, nonatomic) IBOutlet UIButton *loginBtn;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *loginLeading;
@end

@implementation DKLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
//    
//    self.loginBtn.layer.cornerRadius = 5;
//    self.loginBtn.layer.masksToBounds = YES;
    

}

-(void)dealloc
{
    DKFunc
}

- (IBAction)backBtn:(id)sender {
    
    [self.view endEditing:YES];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self dismissViewControllerAnimated:YES completion:nil];
    });
}
- (IBAction)accountBtn:(UIButton *)sender {
    
    //当点击注册账号
    sender.selected = !sender.selected;
    /*
//    if (sender.selected) {
//        [sender setTitle:@"已有账号" forState:UIControlStateSelected];
//    }else{
//        [sender setTitle:@"注册账号" forState:UIControlStateSelected];
//    }
    */
    //让约束来回切换
    if (sender.selected) {
        self.loginLeading.constant = - self.view.dk_width;
    }else{
        self.loginLeading.constant = 0;
    }
    
    //1.从左方移除登录操作界面, 从右方移动到现在的位置
    [UIView animateWithDuration:0.5 animations:^{
       
//        self.loginView.transform = CGAffineTransformMakeTranslation(-1000, 0);
        
        //强制约束
        [self.view layoutIfNeeded];
    }];
    
    //将键盘收回
    [self.view endEditing:NO];
    
    
}

//当modal初控制器,将当前控制器的状态栏设置为白色
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    //将键盘收回
    [self.view endEditing:NO];
}

- (IBAction)login:(id)sender {
}

@end
